(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 11.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       158,          7]
NotebookDataLength[      8015,        244]
NotebookOptionsPosition[      7342,        215]
NotebookOutlinePosition[      7823,        235]
CellTagsIndexPosition[      7780,        232]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{

Cell[CellGroupData[{
Cell["\:5149\:6805\:5316", "Chapter"],

Cell[CellGroupData[{

Cell[BoxData[{
 RowBox[{
  StyleBox[
   RowBox[{
    RowBox[{"Clear", "[", "\"\<Global`*\>\"", "]"}], ";"}], "Code"], 
  "\[IndentingNewLine]", 
  RowBox[{"(*", "\:5b9a\:4e49\:573a\:666f", "*)"}]}], "\n", 
 RowBox[{
  RowBox[{"p1", 
   StyleBox[" ", "Code"], 
   StyleBox["=", "Code"], 
   StyleBox[" ", "Code"], 
   StyleBox[
    RowBox[{"{", 
     RowBox[{"0.1", ",", "0.1"}], "}"}], "Code"]}], 
  StyleBox[";", "Code"]}], "\[IndentingNewLine]", 
 StyleBox[
  RowBox[{
   RowBox[{"p2", " ", "=", " ", 
    RowBox[{"{", 
     RowBox[{"0.9", ",", "0.3"}], "}"}]}], ";"}], 
  "Code"], "\[IndentingNewLine]", 
 StyleBox[
  RowBox[{
   RowBox[{"p3", " ", "=", " ", 
    RowBox[{"{", 
     RowBox[{"0.6", ",", "0.7"}], "}"}]}], ";"}], "Code"], "\n", 
 RowBox[{"Graphics", "[", "\[IndentingNewLine]", 
  RowBox[{
   RowBox[{"{", "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{"Arrow", "[", 
      RowBox[{"{", 
       RowBox[{"p1", ",", "p2"}], "}"}], "]"}], ",", "\[IndentingNewLine]", 
     RowBox[{"Arrow", "[", 
      RowBox[{"{", 
       RowBox[{"p2", ",", "p3"}], "}"}], "]"}], ",", "\[IndentingNewLine]", 
     RowBox[{"Arrow", "[", 
      RowBox[{"{", 
       RowBox[{"p3", ",", "p1"}], "}"}], "]"}]}], "\[IndentingNewLine]", 
    "}"}], ",", "\[IndentingNewLine]", 
   RowBox[{"Axes", "\[Rule]", "True"}], ",", "\[IndentingNewLine]", 
   RowBox[{"PlotRange", "\[Rule]", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"{", 
       RowBox[{"0", ",", "1"}], "}"}], ",", 
      RowBox[{"{", 
       RowBox[{"0", ",", "1"}], "}"}]}], "}"}]}]}], "\[IndentingNewLine]", 
  "]"}]}], "Input",
 Background->RGBColor[
  0.9529411764705882, 0.9529411764705882, 0.9529411764705882]],

Cell[BoxData[
 GraphicsBox[{ArrowBox[{{0.1, 0.1}, {0.9, 0.3}}], 
   ArrowBox[{{0.9, 0.3}, {0.6, 0.7}}], ArrowBox[{{0.6, 0.7}, {0.1, 0.1}}]},
  Axes->True,
  PlotRange->{{0, 1}, {0, 1}}]], "Output"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[{
 RowBox[{
  RowBox[{"width", " ", "=", " ", "100"}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"height", " ", "=", " ", "100"}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"LeftQ", "[", 
    RowBox[{"a_", ",", "b_"}], "]"}], ":=", 
   RowBox[{"(", "\[IndentingNewLine]", 
    RowBox[{
    "(*", "\:5224\:65ad\:5411\:91cfa\:662f\:5426\:5728\:5411\:91cfb\:7684\
\:5de6\:4fa7", "*)"}], "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{
      RowBox[{"(", 
       RowBox[{"a", "\[Cross]", "b"}], ")"}], "\[LeftDoubleBracket]", "3", 
      "\[RightDoubleBracket]"}], "<", "0"}], "\[IndentingNewLine]", ")"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"InsideQ", "[", 
    RowBox[{"p_", ",", "a_", ",", "b_", ",", "c_"}], "]"}], ":=", 
   RowBox[{"(", "\[IndentingNewLine]", 
    RowBox[{
    "(*", "\:5224\:65ad\:70b9p\:662f\:5426\:5728abc\:56f4\:6210\:7684\:4e09\
\:89d2\:5f62\:7684\:5185\:90e8", "*)"}], "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{"LeftQ", "[", 
      RowBox[{
       RowBox[{"Append", "[", 
        RowBox[{
         RowBox[{"p", "-", "a"}], ",", "0"}], "]"}], ",", 
       RowBox[{"Append", "[", 
        RowBox[{
         RowBox[{"b", "-", "a"}], ",", "0"}], "]"}]}], "]"}], "\[Equal]", " ",
      "\[IndentingNewLine]", 
     RowBox[{"LeftQ", "[", 
      RowBox[{
       RowBox[{"Append", "[", 
        RowBox[{
         RowBox[{"p", "-", "b"}], ",", "0"}], "]"}], ",", 
       RowBox[{"Append", "[", 
        RowBox[{
         RowBox[{"c", "-", "b"}], ",", "0"}], "]"}]}], "]"}], "\[Equal]", " ",
      "\[IndentingNewLine]", 
     RowBox[{"LeftQ", "[", 
      RowBox[{
       RowBox[{"Append", "[", 
        RowBox[{
         RowBox[{"p", "-", "c"}], ",", "0"}], "]"}], ",", 
       RowBox[{"Append", "[", 
        RowBox[{
         RowBox[{"a", "-", "c"}], ",", "0"}], "]"}]}], "]"}]}], 
    "\[IndentingNewLine]", ")"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"ScanScreen", "[", 
    RowBox[{"y_", ",", "x_"}], "]"}], ":=", 
   RowBox[{"(", "\[IndentingNewLine]", 
    RowBox[{
    "(*", "ScanScreen\:53c2\:6570\:4f4d\:7f6e\:7684\:8c03\:6362\:548cInsideQ\
\:53c2\:6570\:4f20\:5165\:4e4b\:524d\:7684\:5904\:7406\:90fd\:662f\:4e3a\:4e86\
\:628a\:5c4f\:5e55\:5750\:6807\:6620\:5c04\:5230\:4e16\:754c\:5750\:6807", 
     "*)"}], "\[IndentingNewLine]", 
    RowBox[{"If", "[", 
     RowBox[{
      RowBox[{"InsideQ", "[", 
       RowBox[{
        RowBox[{"{", 
         RowBox[{
          FractionBox[
           RowBox[{"x", "-", "1"}], "width"], ",", 
          FractionBox[
           RowBox[{"height", "-", "y", "-", "1"}], "height"]}], "}"}], ",", 
        "p1", ",", "p2", ",", "p3"}], "]"}], ",", 
      RowBox[{"{", 
       RowBox[{"1", ",", "0", ",", "0"}], "}"}], ",", 
      RowBox[{"{", 
       RowBox[{"1", ",", "1", ",", "1"}], "}"}]}], "]"}], 
    "\[IndentingNewLine]", ")"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{"Image", "[", "\[IndentingNewLine]", 
  RowBox[{
   RowBox[{"Array", "[", 
    RowBox[{
     RowBox[{
      RowBox[{"ScanScreen", "[", "##", "]"}], "&"}], ",", 
     RowBox[{"{", 
      RowBox[{"width", ",", "height"}], "}"}]}], "]"}], ",", 
   "\[IndentingNewLine]", 
   RowBox[{"ColorSpace", "\[Rule]", "\"\<RGB\>\""}]}], "\[IndentingNewLine]", 
  "]"}]}], "Input",
 Background->RGBColor[
  0.9529411764705882, 0.9529411764705882, 0.9529411764705882]],

Cell[BoxData[
 GraphicsBox[
  TagBox[RasterBox[CompressedData["
1:eJzt1EFKBDEURdEGV+JK3INLEB27dZcgogN92FDVXankJ+dBOOGOMsrjy/vz
28Plcnn9OV/37308kSRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJ
kiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJ
kiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkmxtrvd7SJIkq5i7tZMkSa5m7qxO
kiRZ3VzvTpIkWcVctU6SJNnL3OydJEmytblVO0mS5F5z+t9OkiR5zZx+XydJ
kuuY08/tJEmyrjl97E6SJMcxp8/VSZLk+eb0uTpJkmxnTl+7kyTJ7eZ0fU8n
SXJlc7p+RCdJcgVzut6jkyQ5kzldH6mTJDmyOV2v3EmSPNOcrs/YSZJsYU7X
dZIkt5nTdX1/J0muaU7X9fadJDm3OV3X23eS5BzmdF0fr5MkxzSn63r9TpI8
x5yu6+t1kuRt5nRd13v/SyRZxZyu6/qtnSR5+Xe6rutHd5Kc1Zyu63rvTpJV
zOm6rlfrJNnLnK7r+iydJFub03VdX7WT5F5zuq7r+rZOktfM6bqu69s6SeZ0
Xdf1Np3kfOZ0Xdf1MTrJ8c3puq7rNTvJ883puq7rc3WS7czpuq7rY3SSdc3p
uq7r93WS65jTdV2fvZPkUeZ0XddH7SQ5mjld1/WjO0nOak7Xdb33v0SSVczp
ul6/kyTPMafr+nidJFnLnK7r1ztJkr/N6fpKnSTJe8zpeoVOkuQI5nS9ZSdJ
ciZz+tqdJEneb04fu5MkyXHM6W06SZKcz5y+rZMkSeZm7yRJkkeZ691JkiSr
mLu1kyRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJ
kiTJEf0Euw88SQ==
    "], {{0, 100}, {100, 0}}, {0., 1.},
    ColorFunction->RGBColor],
   BoxForm`ImageTag["Real", ColorSpace -> "RGB", Interleaving -> True],
   Selectable->False],
  DefaultBaseStyle->"ImageGraphics",
  ImageSize->{96.80000000000051, Automatic},
  ImageSizeRaw->{100, 100},
  PlotRange->{{0, 100}, {0, 100}}]], "Output"]
}, Open  ]],

Cell[BoxData[""], "Input"]
}, Open  ]]
},
WindowToolbars->"EditBar",
WindowSize->{1584, 826},
WindowMargins->{{-8, Automatic}, {Automatic, 0}},
TaggingRules->{"$testsRun" -> False},
TrackCellChangeTimes->False,
Magnification:>1.25 Inherited,
FrontEndVersion->"11.0 for Microsoft Windows (64-bit) (2016\:5e7410\:67088\
\:65e5)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[CellGroupData[{
Cell[580, 22, 37, 0, 80, "Chapter"],
Cell[CellGroupData[{
Cell[642, 26, 1676, 51, 517, "Input"],
Cell[2321, 79, 197, 4, 465, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[2555, 88, 3408, 93, 734, "Input"],
Cell[5966, 183, 1319, 26, 139, "Output"]
}, Open  ]],
Cell[7300, 212, 26, 0, 37, "Input"]
}, Open  ]]
}
]
*)

